package main

import (
	"code.google.com/p/jesus-1496/models"
	_ "code.google.com/p/jesus-1496/models/pqstorer"
	"encoding/json"
	"fmt"
	"io/ioutil"
	"strings"
)

type jsonHuman struct {
	Name string
	X    uint32
	Y    uint32
}

func main() {
	humanBytes, err := ioutil.ReadFile("humans.json")
	if err != nil {
		fmt.Printf("%v", err)
		return
	}

	var jsonHumans []jsonHuman
	err = json.Unmarshal(humanBytes, &jsonHumans)
	if err != nil {
		fmt.Printf("%v", err)
		return
	}

	for _, jsHuman := range jsonHumans {
		h, _ := models.NewHuman(jsHuman.Name, !strings.Contains(jsHuman.Name, "."), "", "", "", 0, 0, jsHuman.X, jsHuman.Y, "", 0)
		h.SaveNew()
	}
}
